<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
  <title>Document</title>
</head>

<body>
  <div id="app">
    <h2>{{name}}</h2>
    <div>
      <!-- 姓名：<input type="text" v-model="name" @keyup.enter="submit" />
      姓名：<input type="text" :value="name" @input="fn" @keyup.enter="submit" />
      姓名：<input type="text" :value="name" @input="name=$event.target.value" @keyup.enter="submit" /> -->

      <hr>

      <h2>{{age}}</h2>
      <!-- <input type="text" v-model.trim="name" @keyup.enter="submit">
      <input type="text" v-model.number="age" @keyup.enter="submit"> -->
      <!-- <input type="text" v-model.lazy="age" @keyup.enter="submit"> -->
      <input type="text" v-model.lazy.trim="age" @keyup.enter="submit">

    </div>
  </div>
  <script>
    let vm = new Vue({
      el: "#app",
      data() {
        return {
          name: "码路",
          age: 18
        }
      },
      methods: {
        submit(e) {
          // console.log(this.name);
          // console.log(e.target.value);
          console.log(this.age);
          console.log(typeof this.age);
        },
        fn(e) {
          // console.log("fn...");
          this.name = e.target.value;
        }
      },
    });
  </script>
</body>

</html>